import 'package:flutter/material.dart';

class ContainerComp extends StatelessWidget {
  const ContainerComp({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      // 宽度和高度
      width: double.infinity,
      height: double.infinity,
      // 外边距
      // margin: const EdgeInsets.all(20),
      // margin: const EdgeInsets.fromLTRB(10, 20, 30, 40),
      margin: const EdgeInsets.only(left: 20, top: 20),
      // margin: const EdgeInsets.symmetric(horizontal: 10),
      // 内边距
      padding: const EdgeInsets.all(10),
      // 设置对齐方式 9个
      alignment: Alignment.center,
      // 装饰盒子
      decoration: BoxDecoration(
        color: Colors.redAccent,
        // 边框
        border: Border.all(color: Colors.black, width: 5),
        // border: Border(bottom: BorderSide(color: Colors.black, width: 5)),
        // 圆角
        // borderRadius: BorderRadius.circular(10),
        borderRadius: const BorderRadius.only(
            topLeft: Radius.circular(30), bottomRight: Radius.circular(30)),
        // 设置阴影
        boxShadow: const [
          BoxShadow(
            color: Colors.red,
            offset: Offset(-5, 5),
            blurRadius: 5,
          )
        ],
        // 设置渐变色
        gradient: const LinearGradient(
          colors: [Colors.red, Colors.purple],
          begin: Alignment.topLeft,
          end: Alignment.bottomRight,
        ),
      ),
      // 不建议把color写在外边
      // color: Colors.redAccent,
      child: const Text('这是一个容器组件'),
    );
  }
}
